package com.xx.sg.own.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sg_duty")
public class Duty {

    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    @TableField(value = "dept_id")
    private String deptId;

    @TableField(exist = false)
    private Dept dept;

    @TableField(value = "duty_date")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDate dutyDate;

    @TableField(value = "create_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @TableField(value = "delete_flag")
    private String deleteFlag;

    @TableField(exist = false)
    private List<String> staffIds = new ArrayList<>();

    @TableField(exist = false)
    private List<String> leaderIds = new ArrayList<>();

    @TableField(exist = false)
    private List<String> directorIds= new ArrayList<>();

    @TableField(exist = false)
    private List<DutyUser> persons;

    @TableField(exist = false)
    private String monthDate;

    @TableField(exist = false)
    private String dayDate;
}
